package com.aviation.sell_ticket.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class PaymentConfig {

    @Value("${APP_ID}")
    public String APP_ID;

    @Value("${APP_PRIVATE_KEY}")
    public String APP_PRIVATE_KEY;

    @Value("${ALIPAY_PUBLIC_KEY}")
    public String ALIPAY_PUBLIC_KEY;

    @Value("${GATEWAY_URL}")
    public String GATEWAY_URL;

    @Value("${SIGN_TYPE}")
    public String SIGN_TYPE;

    @Value("${FORMAT}")
    public String FORMAT;

    @Value("${CHARSET}")
    public String CHARSET;

    @Bean
    public AlipayClient alipayClient(){
        return new DefaultAlipayClient(GATEWAY_URL,APP_ID,APP_PRIVATE_KEY,FORMAT,CHARSET,ALIPAY_PUBLIC_KEY,SIGN_TYPE);
    }


}
